# Options
ncol.wrap <- 7
x.wrap <- 0.85
y.wrap <- 0.09
height.wrap <- 10
width.wrap <- 14

Traits selected in this study:

  • Height:

    • In Portugal (Fundão): height in October 2012 when the trees were 20-month old.

    • In Asturias(Cabada, Spain): height in November 2012 when the trees were 21-month old.

    • In Bordeaux (Pierroton, France): height in November 2013 when the trees were 25-month old & in November 2018 when the trees were 85-month old.

  • Phenology:

    • mean bud burst (=date of brachybalst emergence) over four years (2013, 2014, 2015 and 2017) in Bordeaux (°C-day)

    • mean duration of bud burst (in 2014)2014, 2015 and 2017) in Bordeaux (°C-day)

  • Functional traits

    • \(\delta^{13}C\)

    • Specific Leaf Area (SLA)

In the document, the plots colored in green correspond to the trait selected in the study.

# Load data
drivers <- readRDS(file="data/DF_Drivers.rds") %>% 
    dplyr::select(prov,A,D,EH.20km.PC1,EH.20km.PC2,EH.1km.PC1,EH.1km.PC2,SHM,EMT)

data <- readRDS(file="data/ClonapinData/PhenoDataNovember2019_AnnualTraits.rds") %>% 
   dplyr::filter(!(prov=="MAD")) %>% 
  inner_join(drivers,by="prov")

1 Height

data %>% dplyr::select(contains("ht")) %>% summary
##   BDX_htnov13      BDX_htnov14    BDX_htnov15    BDX_htnov18    POR_htjan12     POR_htmay12     POR_htoct12      POR_htmay13      AST_htdec11     AST_htnov12      AST_htmar14  
##  Min.   :  40.0   Min.   :  50   Min.   : 190   Min.   : 530   Min.   : 20.0   Min.   : 20.0   Min.   :  90.0   Min.   : 150.0   Min.   : 70.0   Min.   :  90.0   Min.   : 230  
##  1st Qu.: 600.0   1st Qu.: 950   1st Qu.:1360   1st Qu.:3050   1st Qu.:155.0   1st Qu.:230.0   1st Qu.: 350.0   1st Qu.: 520.0   1st Qu.:230.0   1st Qu.: 580.0   1st Qu.:1020  
##  Median : 720.0   Median :1140   Median :1680   Median :3840   Median :210.0   Median :320.0   Median : 450.0   Median : 640.0   Median :280.0   Median : 700.0   Median :1250  
##  Mean   : 737.8   Mean   :1161   Mean   :1712   Mean   :3792   Mean   :213.9   Mean   :332.9   Mean   : 463.1   Mean   : 646.8   Mean   :288.9   Mean   : 710.7   Mean   :1252  
##  3rd Qu.: 860.0   3rd Qu.:1350   3rd Qu.:2040   3rd Qu.:4550   3rd Qu.:265.0   3rd Qu.:420.0   3rd Qu.: 560.0   3rd Qu.: 760.0   3rd Qu.:340.0   3rd Qu.: 840.0   3rd Qu.:1470  
##  Max.   :1650.0   Max.   :2550   Max.   :3770   Max.   :7660   Max.   :580.0   Max.   :870.0   Max.   :1150.0   Max.   :1450.0   Max.   :700.0   Max.   :1640.0   Max.   :2670  
##  NA's   :8448     NA's   :8449   NA's   :8468   NA's   :8477   NA's   :7542    NA's   :7920    NA's   :8940     NA's   :9027     NA's   :7725    NA's   :7713     NA's   :7718

1.1 Bordeaux (France) - November 2013 and 2018

1.1.1 All height values

plot_grid(
ggplot(data, aes(x= BDX_htnov13)) + 
  geom_histogram(binwidth = 20, fill="seagreen3") +  
  theme_bw() + 
  labs(x="Height 2013",y="") +
  annotate("text",x=1500,y=150,label=paste0("Var = ",round(var(data$BDX_htnov13,na.rm=T),2))),

ggplot(data, aes(x= BDX_htnov14)) + 
  geom_histogram(binwidth = 20) +  
  theme_bw() + 
  labs(x="Height 2014",y="") +
  annotate("text",x=2300,y=80,label=paste0("Var = ",round(var(data$BDX_htnov14,na.rm=T),2))),

ggplot(data, aes(x= BDX_htnov15)) + 
  geom_histogram(binwidth = 20) +  
  theme_bw() +
  labs(x="Height 2015",y="") +
  annotate("text",x=3000,y=60,label=paste0("Var = ",round(var(data$BDX_htnov15,na.rm=T),2))),

ggplot(data, aes(x= BDX_htnov18)) + 
  geom_histogram(binwidth = 20, fill="seagreen3") +  
  theme_bw() + 
  labs(x="Height 2018",y="") +
  annotate("text",x=6500,y=50,label=paste0("Var = ",round(var(data$BDX_htnov18,na.rm=T),2))))

1.1.2 Height values per provenances

1.1.2.1 Height - 25-month old - November 2013

# Per provenance
# --------------

# Clones are colored according to the main gene pool (the gene pool for which the provenances have the highest proportion of belonging)

p <- ggplot(data, aes(x=BDX_htnov13, fill=as.factor(max.Q))) + 
  geom_histogram(alpha=0.7) + 
  theme_bw()  +
  facet_wrap(~as.factor(prov)) + 
  scale_fill_manual(values=c("orangered3",   # Northern Africa
                              "gold2",       # Corsica
                              "darkorchid3", # Central Spain
                              "navyblue",    # French Atlantic
                              "turquoise2",  # Iberian Atlantic
                              "green3"       # South-eastern Spain
                             ),
                    labels=c("Northern Africa", 
                             "Corsica",
                             "Central Spain",
                             "French Atlantic",
                             "Iberian Atlantic",
                             "South-eastern Spain")
                    ,name="Gene pools") +
  labs(x="",y="") +
  theme(legend.position = c(0.75, 0.07),
        legend.text = element_text(size=12),
        legend.title = element_text(size=14)) + 
  guides(fill=guide_legend(nrow=2))

p

ggsave(p,file="figs/ExploratoryAnalyses/HeightBordeaux2013.png",height=10,width=12)
# Per provenance
# --------------

# Provenances are colored according to the value of EMT in their location

p <- ggplot(data, aes(x=BDX_htnov13, fill=EMT)) + 
  geom_histogram(alpha=0.7) + 
  theme_bw()  +
  facet_wrap(~as.factor(prov), ncol = ncol.wrap) +
  labs(x="",y="") +
  scale_fill_gradient2(midpoint = mean(data$EMT,na.rm=T), 
                        low = "blue",  
                        mid = "yellow",
                        high = "red",
                        space = "Lab" ,
                       name="Extreme minimum temperature") +
  theme(legend.position = c(x.wrap,y.wrap),
        legend.text = element_text(size=10),
        legend.title = element_text(size=12))

p

ggsave(p,file="figs/ExploratoryAnalyses/HeightBordeaux2013_EMTgradient.png",height=height.wrap,width=width.wrap)

1.1.2.2 Height - 85-month old - November 2018

# Per provenance
# --------------

# Clones are colored according to the main gene pool (the gene pool for which the provenances have the highest proportion of belonging)

p <- ggplot(data, aes(x=BDX_htnov18, fill=as.factor(max.Q))) + 
  geom_histogram(alpha=0.7) + 
  theme_bw()  +
  facet_wrap(~as.factor(prov)) + 
  scale_fill_manual(values=c("orangered3", # Nprthern Africa
                              "gold2",# Corsica
                              "darkorchid3", # Central Spain
                              "navyblue", # french Atlantic
                              "turquoise2", # Iberian Atlantic
                              "green3" # South-eastern Spain
                             ),
                    labels=c("Northern Africa", 
                             "Corsica",
                             "Central Spain",
                             "French Atlantic",
                             "Iberian Atlantic",
                             "South-eastern Spain")
                    ,name="Gene pools") +
  labs(x="",y="") +
  theme(legend.position = c(0.75, 0.07),
        legend.text = element_text(size=12),
        legend.title = element_text(size=14)) + 
  guides(fill=guide_legend(nrow=2))
p

ggsave(p,file="figs/ExploratoryAnalyses/HeightBordeaux2018.png",height=10,width=12)
# Per provenance
# --------------

# Provenances are colored according to the value of EMT in their location

p <- ggplot(data, aes(x=BDX_htnov18, fill=EMT)) + 
  geom_histogram(alpha=0.7) + 
  theme_bw()  +
  facet_wrap(~as.factor(prov), ncol = ncol.wrap) +
  labs(x="",y="") +
  scale_fill_gradient2(midpoint = mean(data$EMT,na.rm=T), 
                        low = "blue",  
                        mid = "yellow",
                        high = "red",
                        space = "Lab" ,
                       name="Extreme minimum temperature") +
  theme(legend.position = c(x.wrap,y.wrap),
        legend.text = element_text(size=10),
        legend.title = element_text(size=12))

p

ggsave(p,file="figs/ExploratoryAnalyses/HeightBordeaux2018_EMTgradient.png",height=height.wrap,width=width.wrap)

1.2 Cabada (Asturias, Spain) - November 2012

1.2.1 All height values

plot_grid(
ggplot(data, aes(x= AST_htdec11)) + 
  geom_histogram(binwidth = 20) +  
  theme_bw() + 
  labs(x="Height - December 2011",y="") +
  annotate("text",x=580,y=300,label=paste0("Var = ",round(var(data$BDX_htnov13,na.rm=T),2))),

ggplot(data, aes(x= AST_htnov12)) + 
  geom_histogram(binwidth = 20, fill="seagreen3") +  
  theme_bw() + 
  labs(x="Height - November 2012",y="") +
  annotate("text",x=1200,y=150,label=paste0("Var = ",round(var(data$BDX_htnov14,na.rm=T),2))),

ggplot(data, aes(x= AST_htmar14)) + 
  geom_histogram(binwidth = 20) +  
  theme_bw() +
  labs(x="Height - March 2014",y="") +
  annotate("text",x=2100,y=100,label=paste0("Var = ",round(var(data$BDX_htnov15,na.rm=T),2))))

1.2.2 Height values per provenances

# Per provenance
# --------------

# Clones are colored according to the main gene pool (the gene pool for which the provenances have the highest proportion of belonging)

p <- ggplot(data, aes(x=AST_htnov12, fill=as.factor(max.Q))) + 
  geom_histogram(alpha=0.7) + 
  theme_bw()  +
  facet_wrap(~as.factor(prov)) + 
  scale_fill_manual(values=c("orangered3",   # Northern Africa
                              "gold2",       # Corsica
                              "darkorchid3", # Central Spain
                              "navyblue",    # French Atlantic
                              "turquoise2",  # Iberian Atlantic
                              "green3"       # South-eastern Spain
                             ),
                    labels=c("Northern Africa", 
                             "Corsica",
                             "Central Spain",
                             "French Atlantic",
                             "Iberian Atlantic",
                             "South-eastern Spain")
                    ,name="Gene pools") +
  labs(x="",y="") +
  theme(legend.position = c(0.75, 0.07),
        legend.text = element_text(size=12),
        legend.title = element_text(size=14)) + 
  guides(fill=guide_legend(nrow=2))

p

ggsave(p,file="figs/ExploratoryAnalyses/HeightAsturias2012.png",height=10,width=12)
# Per provenance
# --------------

# Provenances are colored according to the value of EMT in their location

p <- ggplot(data, aes(x=AST_htnov12, fill=EMT)) + 
  geom_histogram(alpha=0.7) + 
  theme_bw()  +
  facet_wrap(~as.factor(prov), ncol = ncol.wrap) +
  labs(x="",y="") +
  scale_fill_gradient2(midpoint = mean(data$EMT,na.rm=T), 
                        low = "blue",  
                        mid = "yellow",
                        high = "red",
                        space = "Lab" ,
                       name="Extreme minimum temperature") +
  theme(legend.position = c(x.wrap,y.wrap),
        legend.text = element_text(size=10),
        legend.title = element_text(size=12))

p

ggsave(p,file="figs/ExploratoryAnalyses/HeightAsturias2012_EMTgradient.png",height=height.wrap,width=width.wrap)

1.3 Portugal (Fundão) - October 2012

1.3.1 All height values

plot_grid(
ggplot(data, aes(x= POR_htjan12)) + 
  geom_histogram(binwidth = 20) +  
  theme_bw() + 
  labs(x="Height - January 2012",y="") +
  annotate("text",x=400,y=300,label=paste0("Var = ",round(var(data$POR_htjan12,na.rm=T),2))),

ggplot(data, aes(x= POR_htmay12)) + 
  geom_histogram(binwidth = 20) +  
  theme_bw() + 
  labs(x="Height - May 2012",y="") +
  annotate("text",x=600,y=150,label=paste0("Var = ",round(var(data$POR_htmay12,na.rm=T),2))),

ggplot(data, aes(x= POR_htoct12)) + 
  geom_histogram(binwidth = 20,fill="seagreen3") +  
  theme_bw() +
  labs(x="Height - October 2012",y="") +
  annotate("text",x=900,y=100,label=paste0("Var = ",round(var(data$POR_htoct12,na.rm=T),2))),

ggplot(data, aes(x= POR_htmay13)) + 
  geom_histogram(binwidth = 20) +  
  theme_bw() +
  labs(x="Height - May 2013",y="") +
  annotate("text",x=1200,y=100,label=paste0("Var = ",round(var(data$POR_htmay13,na.rm=T),2))))

1.3.2 Height values per provenances

# Per provenance
# --------------

# Clones are colored according to the main gene pool (the gene pool for which the provenances have the highest proportion of belonging)

p <- ggplot(data, aes(x=POR_htoct12, fill=as.factor(max.Q))) + 
  geom_histogram(alpha=0.7) + 
  theme_bw()  +
  facet_wrap(~as.factor(prov)) + 
  scale_fill_manual(values=c("orangered3",    # Northern Africa
                              "gold2",        # Corsica
                              "darkorchid3",  # Central Spain
                              "navyblue",     # French Atlantic
                              "turquoise2",   # Iberian Atlantic
                              "green3"        # South-eastern Spain
                             ),
                    labels=c("Northern Africa", 
                             "Corsica",
                             "Central Spain",
                             "French Atlantic",
                             "Iberian Atlantic",
                             "South-eastern Spain")
                    ,name="Gene pools") +
  labs(x="",y="") +
  theme(legend.position = c(0.75, 0.07),
        legend.text = element_text(size=12),
        legend.title = element_text(size=14)) + 
  guides(fill=guide_legend(nrow=2))


p

ggsave(p,file="figs/ExploratoryAnalyses/HeightPortugal2012.png",height=10,width=12)
# Per provenance
# --------------

# Provenances are colored according to the value of EMT in their location

p <- ggplot(data, aes(x=POR_htoct12, fill=EMT)) + 
  geom_histogram(alpha=0.7) + 
  theme_bw()  +
  facet_wrap(~as.factor(prov), ncol = ncol.wrap) +
  labs(x="",y="") +
  scale_fill_gradient2(midpoint = mean(data$EMT,na.rm=T), 
                        low = "blue",  
                        mid = "yellow",
                        high = "red",
                        space = "Lab" ,
                       name="Extreme minimum temperature") +
  theme(legend.position = c(x.wrap,y.wrap),
        legend.text = element_text(size=10),
        legend.title = element_text(size=12))

p

ggsave(p,file="figs/ExploratoryAnalyses/HeightPortugal2012_EMTgradient.png",height=height.wrap,width=width.wrap)
# Per block
# --------------

data %>% 
  drop_na(POR_htoct12) %>% 
  droplevels() %>% 
  ggplot(aes(x=POR_htoct12, fill=as.factor(block))) + 
  geom_histogram(alpha=0.7) + 
  theme_bw()  +
  facet_wrap(~as.factor(block)) + 
  labs(x="",y="") +
  theme(legend.position = "none")

3 Functional traits

3.1 \(\delta^{13}C\)

data %>% dplyr::select(contains("d13C")) %>% summary
##       d13C       
##  Min.   :-30.47  
##  1st Qu.:-27.14  
##  Median :-26.18  
##  Mean   :-26.26  
##  3rd Qu.:-25.39  
##  Max.   :-22.59  
##  NA's   :9747

3.1.1 All values

ggplot(data, aes(x= d13C)) + 
  geom_histogram(binwidth = 0.1,fill="seagreen3") +  
  theme_bw() + 
  labs(x="Delta 13 C",y="") +
  annotate("text",x=-30,y=60,label=paste0("Var = ",round(var(data$d13C,na.rm=T),2)))

3.1.2 Per provenance

# Per provenance
# --------------

# Clones are colored according to the main gene pool (the gene pool for which the provenances have the highest proportion of belonging)

p <- ggplot(data, aes(x=d13C, fill=as.factor(max.Q))) + 
  geom_histogram(alpha=0.7) + 
  theme_bw()  +
  facet_wrap(~as.factor(prov)) + 
  scale_fill_manual(values=c("orangered3",      # Northern Africa
                              "gold2",          # Corsica
                              "darkorchid3",    # Central Spain
                              "navyblue",       # French Atlantic
                              "turquoise2",     # Iberian Atlantic
                              "green3"          # South-eastern Spain
                             ),
                    labels=c("Northern Africa", 
                             "Corsica",
                             "Central Spain",
                             "French Atlantic",
                             "Iberian Atlantic",
                             "South-eastern Spain")
                    ,name="Gene pools") +
  labs(x="",y="") +
  theme(legend.position = c(0.75, 0.07),
        legend.text = element_text(size=12),
        legend.title = element_text(size=14)) + 
  guides(fill=guide_legend(nrow=2))

p

ggsave(p,file="figs/ExploratoryAnalyses/d13C.png",height=10,width=12)
# Per provenance
# --------------

# Provenances are colored according to the value of EMT in their location

p <- ggplot(data, aes(x=d13C, fill=EMT)) + 
  geom_histogram(alpha=0.7) + 
  theme_bw()  +
  facet_wrap(~as.factor(prov), ncol = ncol.wrap) +
  labs(x="",y="") +
  scale_fill_gradient2(midpoint = mean(data$EMT,na.rm=T), 
                        low = "blue",  
                        mid = "yellow",
                        high = "red",
                        space = "Lab" ,
                       name="Extreme minimum temperature") +
  theme(legend.position = c(x.wrap,y.wrap),
        legend.text = element_text(size=10),
        legend.title = element_text(size=12))

p

ggsave(p,file="figs/ExploratoryAnalyses/d13C_EMTgradient.png",height=height.wrap,width=width.wrap)

3.2 Specific leaf area

data %>% dplyr::select(contains("SLA")) %>% summary
##     POR_SLA     
##  Min.   :2.253  
##  1st Qu.:4.620  
##  Median :5.157  
##  Mean   :5.258  
##  3rd Qu.:5.790  
##  Max.   :9.534  
##  NA's   :9044

3.2.1 All values

plot_grid(ggplot(data, aes(x= POR_SLA)) + 
  geom_histogram(binwidth = 0.1,fill="seagreen3") +  
  theme_bw() + 
  labs(x="Specific Leaf Area",y="") +
  annotate("text",x=9,y=130,label=paste0("Var = ",round(var(data$POR_SLA,na.rm=T),2))),

ggplot(data, aes(x= log(POR_SLA))) + 
  geom_histogram(binwidth = 0.01,fill="seagreen3") +  
  theme_bw() + 
  labs(x="Specific Leaf Area",y="") +
  annotate("text",x=2.05,y=50,label=paste0("Var = ",round(var(log(data$POR_SLA),na.rm=T),2))),
nrow=1)

3.2.2 Per provenance

# Per provenance
# --------------

# Clones are colored according to the main gene pool (the gene pool for which the provenances have the highest proportion of belonging)

p <- ggplot(data, aes(x=POR_SLA, fill=as.factor(max.Q))) + 
  geom_histogram(alpha=0.7) + 
  theme_bw()  +
  facet_wrap(~as.factor(prov)) + 
  scale_fill_manual(values=c("orangered3",    # Northern Africa
                              "gold2",        # Corsica
                              "darkorchid3",  # Central Spain
                              "navyblue",     # French Atlantic
                              "turquoise2",   # Iberian Atlantic
                              "green3"        # South-eastern Spain
                             ),
                    labels=c("Northern Africa", 
                             "Corsica",
                             "Central Spain",
                             "French Atlantic",
                             "Iberian Atlantic",
                             "South-eastern Spain")
                    ,name="Gene pools") +
  labs(x="",y="") +
  theme(legend.position = c(0.75, 0.07),
        legend.text = element_text(size=12),
        legend.title = element_text(size=14)) + 
  guides(fill=guide_legend(nrow=2))

p

ggsave(p,file="figs/ExploratoryAnalyses/PORSLA.png",height=10,width=12)
# Per provenance
# --------------

# Provenances are colored according to the value of EMT in their location


p <- ggplot(data, aes(x=POR_SLA, fill=EMT)) + 
  geom_histogram(alpha=0.7) + 
  theme_bw()  +
  facet_wrap(~as.factor(prov), ncol = ncol.wrap) +
  labs(x="",y="") +
  scale_fill_gradient2(midpoint = mean(data$EMT,na.rm=T), 
                        low = "blue",  
                        mid = "yellow",
                        high = "red",
                        space = "Lab" ,
                       name="Extreme minimum temperature") +
  theme(legend.position = c(x.wrap,y.wrap),
        legend.text = element_text(size=10),
        legend.title = element_text(size=12))

p

ggsave(p,file="figs/ExploratoryAnalyses/PORSLA_EMTgradient.png",height=height.wrap,width=width.wrap)

4 Summary - All selected traits

4.1 Figure S1

fontsize=8
ymean = 0.82
yvar = 0.92

p <- plot_grid(
  # Height Portugal (Fundão) 2012
ggplot(data, aes(x= POR_htoct12)) + 
  geom_histogram(binwidth = 20,fill="#B2182B",alpha=0.7) +  
  theme_bw() +
  labs(x="Height (Portugal, 20 months, mm)",y="") +
  annotation_custom(grobTree(textGrob(paste0("Variance : ",
                                             round(var(data$POR_htoct12,na.rm=T),2)), 
                                      x=0.7,  
                                      y=yvar, 
                                      hjust=0,
                                      gp=gpar(fontsize=fontsize)))) +
  annotation_custom(grobTree(textGrob(paste0("Mean : ",
                                             round(mean(data$POR_htoct12,na.rm=T),2)), 
                                      x=0.7,  
                                      y=ymean, 
                                      hjust=0,
                                      gp=gpar(fontsize=fontsize)))),

  # Height Bordeaux 2013
ggplot(data, aes(x= BDX_htnov13)) + 
  geom_histogram(binwidth = 20, fill="#D73027",alpha=0.7) +  
  theme_bw() + 
  labs(x="Height (Bordeaux, 25 months, mm)",y="") +
  annotation_custom(grobTree(textGrob(paste0("Variance : ",
                                             round(var(data$BDX_htnov13,na.rm=T),2)), 
                                      x=0.7,  
                                      y=yvar, 
                                      hjust=0,
                                      gp=gpar(fontsize=fontsize)))) +
  annotation_custom(grobTree(textGrob(paste0("Mean : ",
                                             round(mean(data$BDX_htnov13,na.rm=T),2)), 
                                      x=0.7,  
                                      y=ymean, 
                                      hjust=0,
                                      gp=gpar(fontsize=fontsize)))),

  # Height Bordeaux 2018
ggplot(data, aes(x= BDX_htnov18)) + 
  geom_histogram(binwidth = 20, fill="#F46D43",alpha=0.7) +  
  theme_bw() + 
  labs(x="Height (Bordeaux, 85 months, mm)",y="") +
  annotation_custom(grobTree(textGrob(paste0("Variance : ",
                                             round(var(data$BDX_htnov18,na.rm=T),2)), 
                                      x=0.7,  
                                      y=yvar, 
                                      hjust=0,
                                      gp=gpar(fontsize=fontsize)))) +
  annotation_custom(grobTree(textGrob(paste0("Mean : ",
                                             round(mean(data$BDX_htnov18,na.rm=T),2)), 
                                      x=0.7,  
                                      y=ymean, 
                                      hjust=0,
                                      gp=gpar(fontsize=fontsize)))),
  
  # Height Cabada (Asturias) 2012
ggplot(data, aes(x= AST_htnov12)) + 
  geom_histogram(binwidth = 20, fill="#FDAE61",alpha=0.7) +  
  theme_bw() + 
  labs(x="Height (Asturias, 21 months, mm)",y="") +
  annotation_custom(grobTree(textGrob(paste0("Variance : ",
                                             round(var(data$AST_htnov12,na.rm=T),2)), 
                                      x=0.7,  
                                      y=yvar, 
                                      hjust=0,
                                      gp=gpar(fontsize=fontsize)))) +
  annotation_custom(grobTree(textGrob(paste0("Mean : ",
                                             round(mean(data$AST_htnov12,na.rm=T),2)), 
                                      x=0.7,  
                                      y=ymean, 
                                      hjust=0,
                                      gp=gpar(fontsize=fontsize)))),

  # Mean bud burst date Bordeaux
ggplot(meanBB,aes(x= mean)) + 
  geom_histogram(binwidth = 10,fill="#5AAE61",alpha=0.7) +  
  theme_bw() + 
  labs(x="Mean bud burst date (Bordeaux, over four years, °C-day)",y="") +
  annotation_custom(grobTree(textGrob(paste0("Variance : ",
                                             round(var(meanBB$mean,na.rm=T),2)), 
                                      x=0.7,  
                                      y=yvar, 
                                      hjust=0,
                                      gp=gpar(fontsize=fontsize)))) +
  annotation_custom(grobTree(textGrob(paste0("Mean : ",
                                             round(mean(meanBB$mean,na.rm=T),2)), 
                                      x=0.7,  
                                      y=ymean, 
                                      hjust=0,
                                      gp=gpar(fontsize=fontsize)))),

  # Mean duration bud burst Bordeaux
ggplot(meanDBB,aes(x= mean)) + 
  geom_histogram(binwidth = 10,fill="#A6DBA0",alpha=0.7) +  
  theme_bw() + 
  labs(x="Mean duration of bud burst (Bordeaux, over three years, °C-day)",y="") +
  annotation_custom(grobTree(textGrob(paste0("Variance : ",
                                             round(var(meanDBB$mean,na.rm=T),2)), 
                                      x=0.7,  
                                      y=yvar, 
                                      hjust=0,
                                      gp=gpar(fontsize=fontsize)))) +
  annotation_custom(grobTree(textGrob(paste0("Mean : ",
                                             round(mean(meanDBB$mean,na.rm=T),2)), 
                                      x=0.7,  
                                      y=ymean, 
                                      hjust=0,
                                      gp=gpar(fontsize=fontsize)))),

  # SLA Portugal 
ggplot(data, aes(x= log(POR_SLA))) + 
  geom_histogram(binwidth = 0.01,fill="#4575B4",alpha=0.7) +  
  theme_bw() + 
  labs(x=TeX("Log(Specific Leaf Area) (Portugal, m$^{2}$/kg)"),y="") +
  annotation_custom(grobTree(textGrob(paste0("Variance : ",
                                             round(var(log(data$POR_SLA),na.rm=T),2)), 
                                      x=0.7,  
                                      y=yvar, 
                                      hjust=0,
                                      gp=gpar(fontsize=fontsize)))) +
  annotation_custom(grobTree(textGrob(paste0("Mean : ",
                                             round(mean(log(data$POR_SLA),na.rm=T),2)), 
                                      x=0.7,  
                                      y=ymean, 
                                      hjust=0,
                                      gp=gpar(fontsize=fontsize)))),
  # delta13C Portugal
ggplot(data, aes(x= d13C)) + 
  geom_histogram(binwidth = 0.1,fill="#ABD9E9",alpha=0.7) +  
  theme_bw() + 
  labs(x=TeX("$\\delta^{13}C$ (Portugal, ‰)"),y="")+
  annotation_custom(grobTree(textGrob(paste0("Variance : ",
                                             round(var(data$d13C,na.rm=T),2)), 
                                      x=0.7,  
                                      y=yvar, 
                                      hjust=0,
                                      gp=gpar(fontsize=fontsize)))) +
  annotation_custom(grobTree(textGrob(paste0("Mean : ",
                                             round(mean(data$d13C,na.rm=T),2)), 
                                      x=0.7,  
                                      y=ymean, 
                                      hjust=0,
                                      gp=gpar(fontsize=fontsize)))),

nrow=4)

p

ggsave(p,file=paste0("figs/ExploratoryAnalyses/TraitsDistribution.png"),width = 10,height=8)

4.2 Table S1 & S2

# the numbers in the columns "Trees", "Populations" and "Clones" were checked with the model inputs (May 12th)
tibble(Traits=c(rep("Height",4),"Mean bud burst date", "Mean duration of bud burst","Surface Leaf Area","$\\delta^{13}$C"),
       
       "Common gardens"=c("Portugal",rep("Bordeaux",2),"Cabada",rep("Bordeaux",2),rep("Portugal",2)),
       
       "Dates of measurement" =c("October 2012","November 2013", "November 2018","November 2012", "2013, 2014, 2015, 2017", "2014, 2015 2017", NA,NA),
       
       "Tree age"=c(20,25,85,21,"-","-",NA,NA),
       
       "Survival"=c(
      # Proportion survival Portugal 
      round(table(data$POR_survoct12)[[2]]/(table(data$POR_survoct12)[[1]]+table(data$POR_survoct12)[[2]]),2),
      
       # Proportion survival Bordeaux 2013
       round(table(data$BDX_surv13)[[2]]/(table(data$BDX_surv13)[[1]]+table(data$BDX_surv13)[[2]]),2),
       
       # Proportion survival Bordeaux 2018
       round(table(data$BDX_surv18)[[2]]/(table(data$BDX_surv18)[[1]]+table(data$BDX_surv18)[[2]]),2),
      
      # Proportion survival Asturias
      round(table(data$AST_survnov12)[[2]]/(table(data$AST_survnov12)[[1]]+table(data$AST_survnov12)[[2]]),2),
 
       "-","-","-","-"),
      
       "Units"=c(rep("mm",4),"°C-day","°C-day","m$^{2}$/kg","‰"),
       
       "Trees"=c(length(data$tree[!is.na(data$POR_htoct12)]),  # height Portugal 2012
                 length(data$tree[!is.na(data$BDX_htnov13)]),  # height Bordeaux 2013
                 length(data$tree[!is.na(data$BDX_htnov18)]),  # height Bordeaux 2018
                 length(data$tree[!is.na(data$AST_htnov12)]),  # height Cabada (Asturias) 2012
                 length(meanBB$tree[!is.na(meanBB$mean)]),     # mean bud burst date Bordeaux
                 length(meanDBB$tree[!is.na(meanDBB$mean)]),   # mean duration bud burst Bordeaux
                 length(data$tree[!is.na(data$POR_SLA)]),      # SLA Portugal 
                 length(data$tree[!is.na(data$d13C)])),        # delta 13 C Portugal 
       
        "Populations" = c(length(unique(data$prov[!is.na(data$POR_htoct12)])), # height Portugal 2012
                          length(unique(data$prov[!is.na(data$BDX_htnov13)])), # height Bordeaux 2013
                          length(unique(data$prov[!is.na(data$BDX_htnov18)])), # height Bordeaux 2018
                          length(unique(data$prov[!is.na(data$AST_htnov12)])), # height Asturias 2012
                          length(unique(meanBB$prov[!is.na(meanBB$mean)])),    # mean bud burst date Bordeaux
                          length(unique(meanDBB$prov[!is.na(meanDBB$mean)])),  # mean duration bud burst Bordeaux
                          length(unique(data$prov[!is.na(data$POR_SLA)])),     # SLA Portugal 
                          length(unique(data$prov[!is.na(data$d13C)]))),       # delta 13 C Portugal 
                          
        "Clones" = c(length(unique(data$clon[!is.na(data$POR_htoct12)])), # height Portugal 2012
                     length(unique(data$clon[!is.na(data$BDX_htnov13)])), # height Bordeaux 2013
                     length(unique(data$clon[!is.na(data$BDX_htnov18)])), # height Bordeaux 2018
                     length(unique(data$clon[!is.na(data$AST_htnov12)])), # height Asturias 2012
                     length(unique(meanBB$clon[!is.na(meanBB$mean)])),    # mean bud burst date Bordeaux
                     length(unique(meanDBB$clon[!is.na(meanDBB$mean)])),  # mean duration bud burst Bordeaux
                     length(unique(data$clon[!is.na(data$POR_SLA)])),     # SLA Portugal 
                     length(unique(data$clon[!is.na(data$d13C)]))),       # delta 13 C Portugal   
       
        "Blocks" = c(length(unique(data$block[!is.na(data$POR_htoct12)])), # height Portugal 2012
                     length(unique(data$block[!is.na(data$BDX_htnov13)])), # height Bordeaux 2013
                     length(unique(data$block[!is.na(data$BDX_htnov18)])), # height Bordeaux 2018
                     length(unique(data$block[!is.na(data$AST_htnov12)])), # height Asturias 2012
                     length(unique(meanBB$block[!is.na(meanBB$mean)])),    # mean bud burst date Bordeaux
                     length(unique(meanDBB$block[!is.na(meanDBB$mean)])),  # mean duration bud burst Bordeaux
                     length(unique(data$block[!is.na(data$POR_SLA)])),     # SLA Portugal 
                     length(unique(data$block[!is.na(data$d13C)])))        # delta 13 C Portugal   
          ) %>% 
  
  kable(caption="Table S1 of the paper",escape = FALSE) %>%
  kable_styling(font_size=11,
                bootstrap_options = c("striped","hover", "condensed"), full_width = F)
Table S1 of the paper
Traits Common gardens Dates of measurement Tree age Survival Units Trees Populations Clones Blocks
Height Portugal October 2012 20 0.66 mm 2746 33 521 8
Height Bordeaux November 2013 25 0.97 mm 3238 33 430 8
Height Bordeaux November 2018 85 0.96 mm 3209 33 430 8
Height Cabada November 2012 21 0.96 mm 3973 33 522 8
Mean bud burst date Bordeaux 2013, 2014, 2015, 2017
°C-day 3175 33 430 8
Mean duration of bud burst Bordeaux 2014, 2015 2017
°C-day 3187 33 430 8
Surface Leaf Area Portugal NA NA
m\(^{2}\)/kg 2642 33 520 8
\(\delta^{13}\)C Portugal NA NA
1939 33 517 8
tab <- c("MeanBB","MeanDBB") %>% 
  mclapply(function(x) {
  if(x=="MeanBB") data <- meanBB else if(x=="MeanDBB") 
    data <- meanDBB
    data %>% 
      dplyr::select(prov,mean) %>% 
      drop_na() %>% 
      dplyr::rename(value=mean) %>% 
      group_by(prov) %>%  
      dplyr::summarise_at("value",list(mean=mean,variance=var)) %>% 
      dplyr::mutate(trait=x)}) %>% 
  bind_rows() %>% 
  pivot_wider(names_from=trait,values_from=c(mean,variance))

tab <- c("POR_htoct12","BDX_htnov13","BDX_htnov18","AST_htnov12","POR_SLA","d13C") %>% 
  mclapply(function(x) 
    data %>% 
      dplyr::select(prov,x) %>% 
      drop_na() %>% 
      group_by(prov) %>% 
      dplyr::summarise_at(all_of(x),list(mean=mean,variance=var)) %>% 
      mutate(trait=x)) %>% 
  bind_rows() %>% 
  pivot_wider(names_from=trait,values_from=c(mean,variance)) %>% 
  inner_join(tab,by="prov") %>% 
  dplyr::select(prov,contains("mean_"),contains("var"))



tab %>% 
  kable(digits=2,caption="Table S2 of the paper",escape = FALSE) %>%
  kable_styling(font_size=10,
                bootstrap_options = c("striped","hover", "condensed"), full_width = F) %>%
  column_spec(1, bold = T)
Table S2 of the paper
prov mean_POR_htoct12 mean_BDX_htnov13 mean_BDX_htnov18 mean_AST_htnov12 mean_POR_SLA mean_d13C mean_MeanBB mean_MeanDBB variance_POR_htoct12 variance_BDX_htnov13 variance_BDX_htnov18 variance_AST_htnov12 variance_POR_SLA variance_d13C variance_MeanBB variance_MeanDBB
ALT 525.56 760.19 4275.38 764.43 5.08 -25.94 1333.05 883.19 25044.03 25994.08 518190.0 43958.36 0.56 1.26 10179.89 11621.08
ARM 505.48 793.33 4450.16 818.89 5.19 -26.01 1282.95 859.95 14693.67 30154.84 416420.9 27155.20 0.53 0.75 5787.12 10512.04
ARN 423.44 651.87 3302.00 652.35 5.19 -26.83 1309.37 861.13 20251.08 26534.21 487704.6 21763.14 0.96 1.68 1199.55 5285.84
BAY 394.29 618.36 3054.03 592.79 5.18 -26.49 1299.02 829.97 15606.98 24433.97 461502.5 20475.10 0.96 1.91 5347.63 7758.00
BON 421.33 600.43 3273.83 702.61 5.37 -26.84 1197.00 752.85 15994.80 30225.90 1159572.0 26013.68 1.08 1.12 3843.38 7596.92
CAD 481.58 847.76 4631.79 781.60 5.34 -25.79 1342.52 898.14 32160.59 55641.88 894272.5 42048.76 0.85 1.11 13379.00 8728.85
CAR 405.52 505.32 2321.30 584.58 4.81 -26.74 1282.36 813.30 18268.47 18912.40 396287.2 11029.61 0.58 1.22 9461.82 8783.43
CAS 501.67 753.01 4202.78 769.32 5.07 -25.90 1310.38 877.46 28617.67 35004.68 554102.0 30359.25 1.00 1.01 6072.29 12050.36
CEN 484.82 663.51 3348.65 723.14 4.91 -26.32 1272.32 849.04 25174.51 31090.09 648606.5 26016.07 0.58 1.36 7633.28 15793.70
COC 406.47 587.13 2735.71 588.77 5.22 -26.47 1320.11 848.06 17647.00 25181.40 573367.0 25089.71 0.89 1.39 6714.06 7676.71
COM 516.92 809.33 3220.71 756.13 4.86 -26.14 1260.71 836.87 22918.15 35020.23 342303.2 57311.18 0.53 0.83 4511.64 11303.29
CUE 402.29 587.38 2793.39 582.10 5.06 -26.35 1313.72 851.46 15749.06 29948.47 745261.0 19274.90 1.02 1.76 7290.54 8915.74
HOU 549.58 841.95 4578.18 831.13 5.32 -25.79 1287.73 832.88 30575.88 36168.73 683021.5 37114.18 0.80 1.09 3998.32 8832.28
LAM 443.56 706.79 3824.82 736.38 5.37 -26.25 1322.51 893.70 18614.34 28385.84 503323.6 35455.80 0.90 1.44 4263.94 6633.86
LEI 467.30 765.64 4156.02 743.20 5.12 -26.34 1317.84 880.28 23362.76 44161.14 799974.2 41372.76 0.81 1.29 8737.24 11448.55
MIM 447.76 783.87 4182.64 718.20 5.34 -26.05 1283.85 832.76 22395.23 51903.59 755436.3 33853.99 0.91 1.94 6008.16 8888.56
OLB 445.60 700.35 3410.89 712.97 5.24 -26.43 1285.80 817.56 15336.79 23496.30 487763.2 24782.38 0.92 1.28 5575.52 9353.93
OLO 549.10 803.57 4390.16 828.55 5.41 -25.63 1287.50 829.00 22867.78 47499.69 534286.6 29013.66 0.84 1.08 4316.43 9240.09
ORI 375.58 667.40 2935.64 639.17 5.40 -26.92 1239.57 797.85 15107.03 21736.00 391840.3 25020.48 1.10 0.94 4685.37 7988.44
PET 525.13 829.51 4471.39 781.10 5.29 -25.81 1306.26 864.40 24369.26 38187.87 665897.4 41792.11 0.67 1.53 3723.47 10308.61
PIA 494.60 838.62 4163.58 783.88 5.22 -26.51 1201.04 793.13 28122.80 44180.50 558897.3 35430.62 0.84 1.39 3697.91 9221.80
PIE 435.18 630.77 3318.63 620.29 5.43 -26.26 1278.11 847.36 19269.41 23336.65 472940.1 30191.09 1.02 1.37 3240.16 7546.22
PLE 468.99 770.15 4044.84 683.62 5.42 -25.92 1306.42 870.85 25399.24 46364.32 868825.2 33619.27 1.12 1.23 5312.36 7901.84
PUE 520.26 865.10 4460.59 775.65 4.98 -26.10 1353.32 902.72 33564.79 45797.49 841781.7 37674.17 0.72 1.11 5397.23 8249.97
QUA 458.63 706.61 3265.79 689.08 4.92 -26.74 1304.61 862.73 20764.43 25415.59 679962.7 27766.85 0.61 1.53 5845.11 8570.03
SAC 436.84 779.80 4317.55 699.71 5.17 -25.69 1333.98 882.42 10276.24 26602.00 665431.4 40020.50 0.56 0.57 10387.92 11888.99
SAL 396.90 582.90 2915.65 592.48 5.33 -26.74 1253.29 802.65 20116.52 15944.42 339030.8 19588.04 0.95 1.01 5040.26 6804.81
SEG 453.87 819.44 4484.53 728.92 5.12 -26.06 1320.39 878.22 19458.77 47514.06 767773.7 26366.13 0.81 1.07 6328.79 10553.06
SIE 445.13 860.65 4266.96 755.56 5.42 -26.11 1337.77 887.32 28151.96 49975.12 431452.8 29270.25 0.88 1.34 5703.93 7581.65
STJ 535.06 893.84 4559.44 794.76 5.43 -25.92 1296.49 838.08 23677.59 45913.57 632962.2 37600.18 0.81 1.60 6258.52 10697.50
TAM 339.09 570.29 2250.45 555.13 5.76 -27.82 1261.34 813.01 12214.55 16014.62 365171.0 23907.35 0.79 0.89 3427.87 7982.86
VAL 431.30 672.13 3393.73 656.09 5.13 -26.56 1258.81 825.76 16849.74 43523.72 860272.1 23268.04 0.92 1.06 6513.53 10003.81
VER 503.62 813.65 4401.61 780.73 5.46 -25.75 1325.48 864.43 22141.52 44992.37 680372.1 34422.39 0.73 1.57 4422.45 8800.61